---
layout: default
title: 标签
---

<script type="text/javascript" src="/assets/vendors/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/assets/js/helpers.js?v=0.4.3"></script>
<script type="text/javascript" src="/assets/js/juicer-min.js?v=0.6.8"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var tagStr = '[ {% for tag in site.tags %}{% if tag[0] != site.tags.first[0] %},{% endif %}"{{ tag[0] }}"{% endfor %} ]';
        var postStr = '{ {% for tag in site.tags %}{% if tag[0] != site.tags.first[0] %},{% endif %}"{{ tag[0] }}":[{% for post in tag[1] %}{% if post != tag[1].first %},{% endif %}{"url":"{{post.url}}.html", "title":"{{post.title}}", "category":"{{post.category}}", "tag":"{{post.tag}}", "exception": "{{post.exception}}", "readtime":"{{post.readtime}}", "date":"{{post.date | date:"%Y-%m-%d"}}"}{% endfor %}]{% endfor %} }';
        var tagData = JSON.parse(tagStr);
        var postData = JSON.parse(postStr);
        var curTag = getUrlParamValue();
        $('#content').html(juicer($('#tag-tpl').html(), {posts: postData[curTag["name"]], tags: tagData}));
    });
</script>

<script type="text/template" id="tag-tpl">
{@if posts}
{@each posts as post}
<div class="posts posts-expand">
    <div class="post post-type-normal ">
        <div class="post-header">
            <h1 class="post-title">
                <a class="post-title-link" href="${post.url}" target="_blank">
                    ${post.title}
                </a>
            </h1>
            <div class="post-meta">
            <span class="post-time">
                写于 ${post.date}
            </span>
                <span class="post-category">
                &nbsp; | &nbsp; 分类于
                <a href="/category.html?name=${post.category}" target="_blank">${post.category}</a>
            </span>
                <span class="post-comments-count" style="display: none">
                <a href="${post.url}" >
                <span class="post-comments-count ds-thread-count" data-thread-key="${post.url}"></span>
                </a>
            </span>
            </div>
        </div>
        <div class="post-body">
            <p><em>涉及知识：${post.tag}</em><br><em>建议阅读：${post.readtime}分钟</em></p>
            <p>
                ${post.exception}
            </p>
            <div class="post-more-link text-center">
                <a class="btn" href="${post.url}" target="_blank">
                    阅读全文 &raquo;
                </a>
            </div>
            <p>
                作者：<a href="http://www.yzsunlei.com/about.html">孙磊</a>&emsp;博客：<a href="http://www.yzsunlei.com">http://www.yzsunlei.com</a><br>
            </p>
        </div>
        <div class="post-footer">
            <div class="post-eof"></div>
        </div>
    </div>
</div>
<hr>
{@/each}
{@else}
<div class="tags">
    <h2>所有标签：</h2>
    <ul>
        {@each tags as tag}
        <li><a href="/tag.html?name=${tag}" target="_blank">${tag}</a></li>
        {@/each}
    </ul>
</div>
{@/if}
</script>